# name : hash: merge mannully using length+loop
# key : hash_merge_mannul_length
# contributor: Shuguang Sun
# --
data ${1:match} ( drop = rc );
  length ${2:key} $9 ${3:s_sat} 8;

  declare AssociativeArray ${4:hh} ();
  rc = $4.DefineKey( '$2' );
  rc = $4.DefineData( '$3' );
  rc = $4.DefineDone();

  do until ( eof1 );
    set ${5:small} end = eof1;
    rc = $4.add(); ** keep the first;
    ** rc = $4.replace(); ** keep the last;
    end;

  do until ( eof2 );
    set ${6:large} end = eof2;
    rc = $4.find();
    if rc = 0 then output;
    end;
  stop;
run;